package com.example.mobile2121606109ycg0330homework;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;

import androidx.appcompat.app.AppCompatActivity;

public class MainActivity extends AppCompatActivity {

    private ImageView ivMainImg;
    private Button btnMainSwh;
    private  int i;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initView();
        btnMainSwh.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                i++;
                if (i == 1){
                    ivMainImg.setImageResource(R.drawable.line01_01);
                }else if (i ==2){
                    ivMainImg.setImageResource(R.drawable.line01_02);
                }else if (i ==3){
                    ivMainImg.setImageResource(R.drawable.line01_03);
                }else if (i ==4){
                    ivMainImg.setImageResource(R.drawable.line01_04);
                }else if (i ==5){
                    ivMainImg.setImageResource(R.drawable.line01_05);
                }else if (i ==6){
                    ivMainImg.setImageResource(R.drawable.line01_06);
                }else {
                    i = 0;
                }
            }
        });
    }

    private void initView() {
        ivMainImg = (ImageView) findViewById(R.id.ivMainImg);
        btnMainSwh = (Button) findViewById(R.id.btnMainSwh);
    }
}